package com.sbtr.common.enums;

public enum OperatorTypeEnum {

    filter("filter", "过滤处理"),
    missing("missing", "缺失值处理"),
    duplicate("duplicate", "重复值处理"),
    attributecreate("attributecreate", "属性生成处理"),
    standard("standard", "数据标准化"),
    pca("pca", "主成分分析"),
    ;


    String code;
    String title;

    OperatorTypeEnum(String code, String title) {
        this.code = code;
        this.title = title;
    }

    public String getCodeByTitle(String title) {
        OperatorTypeEnum[] operatorTypeEnum = values();
        for (OperatorTypeEnum operatorEnum : operatorTypeEnum) {
            if (operatorEnum.getTitle().equals(title)) {
                return operatorEnum.getCode();
            }
        }
        return null;
    }

    public String getTitleByCode(String code) {
        OperatorTypeEnum[] operatorTypeEnum = values();
        for (OperatorTypeEnum operatorEnum : operatorTypeEnum) {
            if (operatorEnum.getCode().equals(code)) {
                return operatorEnum.getTitle();
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getTitle() {
        return title;
    }

}
